<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('施工日志列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
<!--                            <li>-->
<!--                                <label>资料名称：</label>-->
<!--                                <input type="text" name="cName"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>上传资料：</label>-->
<!--                                <input type="text" name="cFile"/>-->
<!--                            </li>-->
<!--                            <li class="select-time">-->
<!--                                <label>上传时间：</label>-->
<!--                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginCTime]"/>-->
<!--                                <span>-</span>-->
<!--                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endCTime]"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>上传人：</label>-->
<!--                                <input type="text" name="cHeir"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>备注：</label>-->
<!--                                <input type="text" name="cRemark"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>材料名称：</label>-->
<!--                                <input type="text" name="cTname"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>材料数量：</label>-->
<!--                                <input type="text" name="cTnum"/>-->
<!--                            </li>-->
                            <li>
                                <label>项目名称：</label>
                                <input type="text" name="pName"/>
                            </li>
                            <li class="select-time">
                                <label>创建时间：</label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginPTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endPTime]"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="ruoyi:material:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
     <th:block th:include="include :: footer" />
     <script th:inline="javascript">
         var removeFlag = [[${@permission.hasPermi('ruoyi:recording:remove')}]];
         var creadFlag = [[${@permission.hasPermi('ruoyi:recording:add')}]];
         //工程文件字典类型
         var beType = [[${@dict.getType('sys_planlog_type')}]];
         var prefix = ctx + "system/building";
         var prefixs = ctx + "ruoyi/recording";


         $(function() {
             var options = {
                 url: prefix + "/list",
                 createUrl: prefixs + "/add/{id}",
                 exportUrl: prefixs + "/export",
                 removeUrl: prefixs + "/remove",
                 modalName:"",
                 showSearch: false,
                 showRefresh: false,
                 showToggle: false,
                 showColumns: false,
                 detailView: true,
                 onExpandRow: function (index, row, $building) {
                     initChildTable(index, row, $building);
                 },

                 columns: [{
                     checkbox: true
                 },
                     {
                         field: 'pId',
                         title: '项目id',
                         visible: false
                     },
                     {
                         field: 'pName',
                         title: '项目名称'
                     },
                     {
                         field: 'pTime',
                         title: '项目日期'
                     },
                     {
                         field: 'pFounder',
                         title: '项目经理'
                     },
                     {
                         title: '操作',
                         align: 'center',
                         formatter: function(value, row, index) {
                             var actions = [];
                             actions.push('<a class="btn btn-success ' + creadFlag + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.pId + '\')"><i class="fa fa-add"></i>添加</a> ');
                             return actions.join('');
                         }
                     }
                 ]
             };
             $.table.init(options);
         });

         initChildTable = function (index, row, $building) {
             var childTable = $building.html('<table style="table-layout:fixed"></table>').find('table');
             $(childTable).bootstrapTable({
                 url: prefixs  + "/lists",
                 method: 'post',
                 sidePagination: "server",
                 contentType: "application/x-www-form-urlencoded",
                 queryParams: {
                     sid:row.pId
                 },
                 columns: [
                     {
                         field: 'cId',
                         title: '资料id',
                         visible: false
                     },
                     {
                         field: 'cName',
                         title: '资料名称'
                     },
                     {
                         field: 'cFile',
                         title: '上传资料',
                         formatter: function(value, row, index) {
                             //return '<a href="javascript:downloadFile(\''+row.cFile+'\')">下载</a>';
                             return $.table.imageView(value);
                         }

                     },
                     {
                         field: 'cTime',
                         title: '上传时间',

                     },
                     {
                         field: 'cHeir',
                         title: '上传人'
                     },
                     {
                         field: 'cRemark',
                         title: '备注'
                     },
                     {
                         field: 'cTname',
                         title: '材料名称'
                     },
                     {
                         field: 'cTnum',
                         title: '材料数量'
                     },
                     {
                         field: 'cPid',
                         title: '项目信息',
                         visible: false

                     },
                     // {
                     //     title: '操作',
                     //     align: 'center',
                     //     formatter: function (value, row, index) {
                     //         var actions = [];
                     //         actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.cId + '\')"><i class="fa fa-remove"></i>删除</a>');
                     //         return actions.join('');
                     //     }
                     // }

                 ]
             });
         };
        /* function downloadFile(pUploading) {
             window.location.href=ctx+"common/download/resource?resource="+pUploading;
         }*/
     </script>
</body>
</html>